
package game;

import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

/**
 *
 * @author pedroxx
 */
public class Game {

    static Frame container = new Frame("myGame");
    
    public static void main(String[] args) {
        Screen screen= new Screen();
        
        container.setSize(320, 240);
        container.add(screen);        
        container.setVisible(true);
        
        container.addWindowListener(new WindowAdapter() {
                                            public void windowClosing(WindowEvent e){
                                                System.exit(0);
                                            }
                                        }
                                   );
        
        long start, end;        
        while(true){
            
            start = System.currentTimeMillis();
            screen.refresh();                    
            do{
                end = System.currentTimeMillis();
                screen.repaint();
            }while((int)(end - start) < 10);                        
        }
    }
}
